home *** CD-ROM | disk | FTP | other *** search
-
- function units_submarine_setup()
- units_setup_sea(4,false,true,ENET_EFFECT_GEOMETRY_SUBMARINESHADOW)
- units_reloadfirespots(uniGetExecutor(),1,ENET_EFFECT_SUBROCKET)
- end
-
- function units_submarine_resetup()
- units_setup_sea(4,false,false,ENET_EFFECT_GEOMETRY_SUBMARINESHADOW)
- units_reloadfirespots(uniGetExecutor(),1,ENET_EFFECT_SUBROCKET)
- end
-
- function units_submarine_select()
- units_select(12,1)
- end
-
- function units_submarine_unselect()
- units_unselect()
- end
-
- function units_submarine_selectenemy()
- uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
- end
-
- function units_submarine_damaged()
- uniGetExecutor():applyDamage(uniGetLife())
- end
-
- function units_submarine_highlight()
- uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
- end
-
- function units_submarine_explode()
- units_explode_water3()
- end
-
- function units_submarine_fire()
- local unit = uniGetExecutor()
- uniSetLife(uniGetLife() / 4.0)
- local gt = unit:getBone(ENBT_GUNNEST)
- unit:play3DSound("submarine turn.wav",0)
- waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNITTOTARGET,MATH_PI,uniGetTarget()))
- local guns = {}
- guns[0] = gt:getBone(ENBT_GUN,0)
- guns[1] = gt:getBone(ENBT_GUN,1)
- local rots = {}
- rots[0] = guns[0]:addRotationEffect(ENET_EFFECT_ROTATE_WHEEL,-MATH_PI / 3.0,nil)
- rots[1] = guns[1]:addRotationEffect(ENET_EFFECT_ROTATE_WHEEL,-MATH_PI / 3.0,nil)
- pause(0.7)
- rots[0]:destroy()
- rots[1]:destroy()
- local i
- for i=0,3 do
- local shot1
- unit:findEffect(ENET_EFFECT_SUBROCKET):executeCommand(ENC_FIRE1)
- if(i < 2) then
- shot1 = guns[0]:addBulletEffect(ENET_EFFECT_PS_SUBMARINESHOT)
- end
- if(i > 1) then
- shot1 = guns[1]:addBulletEffect(ENET_EFFECT_PS_SUBMARINESHOT)
- end
- pause(0.4)
- shot1:suspendedDestroy(2.0)
- end
- units_reloadfirespots(uniGetExecutor(),1,ENET_EFFECT_SUBROCKET)
- pause(1.0)
- guns[0]:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI / 3.0)
- guns[1]:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI / 3.0)
- unit:addFireArrow()
- end
-
- function units_submarine_move()
- local unit = uniGetExecutor()
- unit:play3DSound("submarine turn.wav",0)
- waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.6))
- local wPos = unit:getWorldPosition()
- wPos.y = wPos.y - 10
- unit:play3DSound("submarine dive noise.wav",0)
- waitDeath(unit:linearFly(wPos,10))
- wPos = uniGetPosition()
- wPos.y = wPos.y - 10
- waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,80))
- wPos = unit:getWorldPosition()
- wPos.y = wPos.y + 10
- unit:play3DSound("submarine surface noise.wav",0)
- waitDeath(unit:linearFly(wPos,10))
- end
-
- -- register functions to unit scriptset - they will be called when specified command arrives to unit
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_MOVE,"units_submarine_move")
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_FIRE1,"units_submarine_fire")
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_FIRE2,"units_submarine_fire")
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_SELECT,"units_submarine_select")
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_SELECTENEMY,"units_submarine_selectenemy")
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_UNSELECT,"units_submarine_unselect")
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_SETUP,"units_submarine_setup")
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_RESETUP,"units_submarine_resetup")
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_DAMAGED,"units_submarine_damaged")
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_EXPLODE,"units_submarine_explode")
- registerCommand(ENSCRIPTSET_SUBMARINE,ENC_HIGHLIGHT,"units_submarine_highlight")
-
- -- make description of unit
- desc = getEffectDescriptionP(ENET_UNIT_SUBMARINE)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "submarine.rmd"
- desc.ScriptSet = ENSCRIPTSET_SUBMARINE
- --desc.MoveType = ENMOVE_SWIM
- desc.MoveType = ENMOVE_FLY
- desc.RenderType = ENRENDERTYPE_GEOMETRY
- desc.Material = ENMAT_RIGIDSKINNEDMESH
- desc.MaterialColors = units_materialcolors_human
-
- -- shadow
- desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_SUBMARINESHADOW)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "submarine_shadow.rmd"
- desc.RenderType = ENRENDERTYPE_SHADOW
- desc.Material = ENMAT_SHADOW
- desc.MaterialColors = units_materialcolors_shadow
-
- -- register new unit to logic
- unitDesc = logic_getUnitDescP(33)
- unitDesc.group = 1
- unitDesc.order = 2
- unitDesc.unit_res_id = ENET_UNIT_SUBMARINE
- unitDesc.unit_icon_id = "Submarine_h_small_normal.dds"
- unitDesc.active_id = "Submarine_h_small_active.dds"
- unitDesc.pressed_id = "Submarine_h_small_pressed.dds"
- unitDesc.big_icon_id = "Submarine_h_big_normal.dds"
- unitDesc.small_icon_id = "Submarine_u_stats.dds"
- unitDesc.HP = 4
- unitDesc.MP = 50
- unitDesc.WR = 2
- unitDesc.min_WR = 2
- unitDesc.WD = 2
- unitDesc.WR2 = 0
- unitDesc.min_WR2 = 0
- unitDesc.WD2 = 0
- unitDesc.ability = 8
- unitDesc.transport = 0
- unitDesc.value = 3
- unitDesc.race = 0
- unitDesc.fire_pause = 0.6
- unitDesc.move_pause = 0.5
- unitDesc.unit_info_scale = 0.07
- unitDesc.scn_name = "SUBMARINE"
-
-
- ------------------------------------------------------------------------------------------------------
- ------------------------ effects related to unit------------------------------------------------------
- ------------------------------------------------------------------------------------------------------
-
- function bullets_subrocket_fire()
- local bullet = uniGetExecutor()
- bullet:setTransformOwner()
- bullet:play3DSound("bigrocket_rocket_start.wav",0)
- waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_ROCKETSTART,110,uniGetTarget(),100.0))
- local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_ROCKETENGINE)
- -- local sound = bullet:play3DSound("bigrocket_rocket_fly.wav",1)
- bullet:play3DSound("bigrocket_rocket_fly.wav",0)
- local track = bullet:addSimpleEffect(ENET_EFFECT_PS_SUBMARINESHOT_FLY)
- -- waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_ROCKETFLYPARABOLA,150,uniGetTarget()))
- waitDeath(bullet:parabolicFly(uniGetTarget()))
- -- sound:destroy()
- light:destroy()
- track:suspendedDestroy(3.0)
- bullet:play3DSound("bigrocket_rocket_explode.wav",0)
- bullet:setVisibility(false,true)
- --bullet:addSimpleEffect(ENET_EFFECT_LIGHT_ROCKETEXPLODE):delayedDestroy(1.0)
- --bullet:addSimpleEffect(ENET_EFFECT_PS_BIGROCKETEXPLODE):suspendedDestroy(1.0)
- bullet:addSimpleEffect(ENET_EFFECT_PS_SUBMARINESHOT_EXPLOSION):suspendedDestroy(3.0)
- uniGetTarget():executeCommand(ENC_DAMAGED)
- pause(1.0)
- bullet:suspendedDestroy(3.0)
- end
-
- --registerCommand(ENSCRIPTSET_SUB_ROCKET,ENC_FIRE1,"bullets_subrocket_fire")
-